#!/bin/bash
#:e! ~/src/vim-bash-hacks/src/bash/mkj2mefiles.sh
#set -x
start_secs=$SECONDS
#set +x
script_path="$(dirname $0)"
export one_fn=
if [[ "$1" = "-f" ]] ; then
	export one_fn="$2"
	shift 1
fi
set +x
export ii=$II
export i=$I
op_sys=$(/bin/uname -s)
#set -x
. $i/setopsys.sh
echo "#!/bin/sh" > $ii/srcenv.ksh
vfiles[0]="j2merss1" #f11 (was f6)
vfiles[1]="j2mejlo" #f2
vfiles[2]="j2merss1o" #f12 (was f7)
vfiles[3]="j2memste1" #j2memste1
vfiles[4]="j2memailsc" #j2mema&ilsc
vfiles[5]="j2memail" #j2memail&y
vfiles[6]="j2mefin" #s-f4
vfiles[7]="j2merevsuite" #j2merevs&uite
vfiles[8]="j2meowa" #s-f12
vfiles[9]="j2megro" #j2me&gro
vfiles[10]="j2merss2o" #j2merss2&o
vfiles[11]="j2mesms2" #j2mesms&2
vfiles[12]="j2megspbt" #j2megsp&bt
vfiles[13]="j2megspbg" #j2meg&spbg
vfiles[14]="j2meafriare"
vfiles[15]="j2sesprss" #j2ses&prss
vfiles[16]="j2mejmunit" #j2me&jmunit
vfiles[17]="j2meebplus" #j2meebp&lus
vfiles[18]="j2mevim" #j2me&vim
vfiles[19]="j2mejmperf" #j2mejmp&erf
vfiles[20]="j2metwim" #j2met&wim
vfiles[21]="j2menews" #j2me&news
vfiles[22]="j2mekablog" #j2me&kablog
vfiles[23]="j2meyapplrss" #j2me&yapplrss
vfiles[24]="j2meespeak" #j2meespe&ak
vfiles[25]="j2megoldsms" #j2megolds&ms
export vfiles

kfiles[0]="<F11>" #f11 (was f6)
kfiles[1]="<F2>" #f2
kfiles[2]="<F12>" #f12 (was f7)
kfiles[3]=""
kfiles[4]=""
kfiles[5]=""
kfiles[6]=""
kfiles[7]=""
kfiles[8]="<S-F12>" #s-f12
kfiles[9]=""
kfiles[10]=""
kfiles[11]=""
kfiles[12]=""
kfiles[13]=""
kfiles[14]=""
kfiles[15]=""
kfiles[16]=""
kfiles[17]=""
kfiles[18]=""
kfiles[19]=""
kfiles[20]=""
kfiles[21]=""
kfiles[22]=""
kfiles[23]=""
kfiles[24]=""
kfiles[25]=""
export kfiles

mfiles[0]=""
mfiles[1]=""
mfiles[2]=""
mfiles[3]="j2memste&1" #Alt-g 1
mfiles[4]="j2mema&ilsc" #Alt-g i
mfiles[5]="j2memail&y" #Alt-g y
mfiles[6]="j2me&fin"  #Alt-g f
mfiles[7]="j2merevs&uite" #Alt-g u
mfiles[8]=""
mfiles[9]="j2me&gro" #Alt-g g
mfiles[10]="j2merss2&o" #Alt-g o
mfiles[11]="j2mesms&2" #Alt-g 2
mfiles[12]="j2megsp&bt" #Alt-g b
mfiles[13]="j2meg&spbg" #Alt-g s
mfiles[14]="j2meaf&riware" #Alt-g r
mfiles[15]="j2ses&prss" #Alt-g p
mfiles[16]="j2me&jmunit" #Alt-g j
mfiles[17]="j2meebp&lus" #Alt-g l
mfiles[18]="j2me&vim" #Alt-g v
mfiles[19]="j2mejmp&erf" #Alt-g e
mfiles[20]="j2met&wim" #Alt-g w
mfiles[21]="j2me&news" #Alt-g n
mfiles[22]="j2me&kablog" #Alt-g k
mfiles[23]="j2me&yapplrss" #Alt-g y
mfiles[24]="j2meespe&ak" #Alt-g a
mfiles[25]="j2megolds&ms" #Alt-g m

export mfiles

cfiles[0]=""
cfiles[1]=""
cfiles[2]=""
cfiles[3]="<C-k>1" #Ctl-k 1
cfiles[4]="<C-k>i" #Ctl-k i
cfiles[5]="<C-k>y" #Ctl-k y
cfiles[6]="<C-k>f"  #Ctl-k f
cfiles[7]="<C-k>u"  #Ctl-k u
cfiles[8]=""
cfiles[9]="<C-k>g" #Ctl-k g
cfiles[10]="<C-k>o" #Ctl-k o
cfiles[11]="<C-k>2" #Ctl-k 2
cfiles[12]="<C-k>b" #Ctl-k b
cfiles[13]="<C-k>s" #Ctl-k s
cfiles[14]="<C-k>r" #Ctl-k r
cfiles[15]="<C-k>p" #Ctl-k p
cfiles[16]="<C-k>j" #Ctl-k j
cfiles[17]="<C-k>l" #Ctl-k l
cfiles[18]="<C-k>v" #Ctl-k v 
cfiles[19]="<C-k>e" #Ctl-k e
cfiles[20]="<C-k>w" #Ctl-k w
cfiles[21]="<C-k>n" #Ctl-k n
cfiles[22]="<C-k>k" #Ctl-k k
cfiles[23]="<C-k>y" #Ctl-k y
cfiles[24]="<C-k>a" #Ctl-k a
cfiles[25]="<C-k>m" #Ctl-k m

export cfiles

echo is_cygwin=$is_cygwin
echo is_vista=$is_vista
function mkprojfile {
#set -x
fn_nbr=$1
wtkproj="$2"
svnproj="$3"
. $script_path/mkj2melines.sh $is_cygwin $is_vista $fn_nbr ${vfiles[$fn_nbr]} "$wtkproj" "$svnproj" "$4" "$5" 2>&1 | tee ${vfiles[$fn_nbr]}.log
set +x
}
. $script_path/mkj2melines.sh $is_cygwin $is_vista 0 ${vfiles[0]} RSSReader mobile-rss-reader | tee ${vfiles[0]}.log
. $script_path/mkj2melines.sh $is_cygwin $is_vista 1 ${vfiles[1]} JLogMicro jlogmicro | tee ${vfiles[1]}.log
#. $script_path/mkj2melines.sh $is_cygwin $is_vista 2 ${vfiles[2]} RSSReadero mobile-rss-reader/1.11.1 | tee ${vfiles[2]}.log
mkprojfile 2 RSSReadero mobile-rss-reader/1.11.1
. $script_path/mkj2melines.sh $is_cygwin $is_vista 3 ${vfiles[3]} Bubblet mobilesuite/trunk/Bubblet mobilesuite/trunk/Mebis mobilesuite/trunk/MineSweeper mobilesuite/trunk/NewsReader mobilesuite/trunk/PacMan mobilesuite/trunk/PacMan_Tools mobilesuite/trunk/Reversi mobilesuite/trunk/SecureSMS mobilesuite/trunk/TestSuite mobilesuite/trunk/TestSuite_Tools mobilesuite/trunk/Mebis mobilesuite/trunk/libJ2ME mobilesuite/trunk/libJ2ME_GameSkel mobilesuite/trunk/libJ2ME_TestApp | tee ${vfiles[3]}.log
export mailreaderdrive="E:"
export mailreaderscript="${mailreaderdrive}/mostdownloads/gnu/apache/struts/struts-1.3.8/apps/struts-scripting-mailreader-1.3.8"
. $script_path/mkj2melines.sh -h $mailreaderscript $is_cygwin $is_vista 4 ${vfiles[4]} MailReaderScript mail-reader | tee ${vfiles[4]}.log
export mailreader="${mailreaderdrive}/mostdownloads/gnu/apache/struts/struts-1.3.8/apps/struts-mailreader-1.3.8"
. $script_path/mkj2melines.sh -h $mailreader 5 $is_cygwin $is_vista ${vfiles[5]} MailReader mail-reader | tee ${vfiles[5]}.log
. $script_path/mkj2melines.sh $is_cygwin $is_vista 6 ${vfiles[6]} Finarea finarea-midlet | tee ${vfiles[6]}.log
. $script_path/mkj2melines.sh $is_cygwin $is_vista 7 ${vfiles[7]} Reversi mobilesuite/Reversi mobilesuite/libJ2ME | tee ${vfiles[7]}.log
. $script_path/mkj2melines.sh $is_cygwin $is_vista 8 ${vfiles[8]} Oware oware-midlet | tee ${vfiles[8]}.log
. $script_path/mkj2melines.sh $is_cygwin $is_vista 9 ${vfiles[9]} Groceries groceries-midlet  | tee ${vfiles[9]}.log
. $script_path/mkj2melines.sh $is_cygwin $is_vista 10 ${vfiles[10]} RSSReaderold mobile-rss-reader | tee ${vfiles[10]}.log
. $script_path/mkj2melines.sh $is_cygwin $is_vista 11 ${vfiles[11]} SecureSMS SecureSMS | tee ${vfiles[11]}.log
. $script_path/mkj2melines.sh $is_cygwin $is_vista 12 ${vfiles[12]} GASPBT GASPBT | tee ${vfiles[12]}.log
. $script_path/mkj2melines.sh $is_cygwin $is_vista 13 ${vfiles[13]} BomberGASP BomberGASP | tee ${vfiles[13]}.log
export mailreader="${mailreaderdrive}/mostdownloads/gnu/apache/struts/struts-1.3.8/apps/struts-mailreader-1.3.8"
. $script_path/mkj2melines.sh -h ~/src/afriwarestore $is_cygwin $is_vista 14 ${vfiles[14]} afriware afriware | tee ${vfiles[14]}.log
. $script_path/mkj2melines.sh -h $srss $is_cygwin $is_vista 15 ${vfiles[15]} spring-rss-reader spring-rss-reader  | tee ${vfiles[15]}.log
. $script_path/mkj2melines.sh $is_cygwin $is_vista 16 ${vfiles[16]} JMUnit jmunit-plus | tee ${vfiles[16]}.log
. $script_path/mkj2melines.sh $is_cygwin $is_vista 17 ${vfiles[17]} EBookPlusME ebookplusme | tee ${vfiles[17]}.log
. $script_path/mkj2melines.sh -h ~/src/vim-bash-hacks $is_cygwin $is_vista 18 ${vfiles[18]} vim-bash-hacks vim-bash-hacks | tee ${vfiles[18]}.log
. $script_path/mkj2melines.sh $is_cygwin $is_vista 19 ${vfiles[19]} JMUnitPerf jmunitperf | tee ${vfiles[19]}.log
. $script_path/mkj2melines.sh $is_cygwin $is_vista 20 ${vfiles[20]} Twim twim | tee ${vfiles[20]}.log
mkprojfile 21 NewsReader news-reader
mkprojfile 22 Kablog kablog_lib_j2me
mkprojfile 23 YAppletRSSReader yinlight-applet-rss-reader
mkprojfile 24 ESpeak mobile-java-espeak
mkprojfile 25 GoldenSMS goldensms
end_secs=$SECONDS
echo \
  "ELAPSED=$(( (end_secs - start_secs)/60 )):$(( (end_secs - start_secs)%60 ))"
